Using Regular Expressions to convert XML shorthand format to XML longhand f

Hello,

I have an XML file in a given string and I would like to run through this string and replace any occurance of <emptytag/> by <emptytag></emptytag>. Yes, I do know that both XML formats are valid. However, DOORS does not seem to want correctly process the short-hand XML.
 

<xmltest>
    <emptytag></emptytag>     // good for DOORS
    <emptytag/>               // bad for DOORS
</xmltest>

 


I am not very familiar with DOORS RegExps, maybe someone can provide a snippet in order to get me started on this issue?

Thanks in advance !

Patrick

 


PatrickGuay - Tue Feb 05 12:46:21 EST 2013

Re: Using Regular Expressions to convert XML shorthand format to XML longhand f
Mathias Mamsch - Wed Feb 06 08:20:14 EST 2013

If there is no special performance requirement to your code (i.e. a lot of very large XML files need to be parsed), I would use the Microsoft XML COM library to read the XML file and output it again. It has a flag for the output writer, that will allow you to convert the empty tags in either way. If you need more info, just msg again. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS